//package pri.zxx.webdemo.aop;
//
//import com.alibaba.fastjson.JSON;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.After;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.aspectj.lang.annotation.Pointcut;
//import org.aspectj.lang.reflect.MethodSignature;
//import org.springframework.stereotype.Component;
//
//import java.util.Map;
//
///**
// * @author xigua
// * @desc
// * @createTime 2020-11-15-下午8:42
// */
//@Aspect
//@Slf4j
//@Component
//public class MehodAspect {
//
//    private ThreadLocal<Map<String, Map<String, MethodInfo>>> mapThreadLocal = new ThreadLocal<>();
//
//
//    @Pointcut(value = "execution(public * pri.zxx.webdemo.controllers..*(..)))")
//    public void meh() {
//    }
//
//    @Before(value = "meh()")
//    public void before(JoinPoint jp) {
//        long start = System.currentTimeMillis();
//        MethodSignature signature = (MethodSignature) jp.getSignature();
//        String name = signature.getName();
//        MethodInfo methodInfo = new MethodInfo();
//        methodInfo.setMethodName(name);
//        methodInfo.setInvokeTimes(1);
//        methodInfo.setStartTime(start);
//
//        Map<String, Map<String, MethodInfo>> stringMapMap = mapThreadLocal.get();
//
//        new Map<>
//        stringMapMap.put(name, methodInfo);
//
//    }
//
//    @After("meh()")
//    public void after(JoinPoint jp) {
//        long endTime = System.currentTimeMillis();
//        MethodSignature signature = (MethodSignature) jp.getSignature();
//        String name = signature.getName();
//        MethodInfo methodInfo = mapThreadLocal.get().get(name);
//        if (methodInfo != null) {
//            long time = endTime - methodInfo.getStartTime();
//            methodInfo.setEndTime(endTime);
//            methodInfo.setMaxTime(time > methodInfo.getMaxTime() ? time : methodInfo.getMaxTime());
//            methodInfo.setMinTime(time < methodInfo.getMinTime() ? time : methodInfo.getMinTime());
//        }
//        log.warn(JSON);
//    }
//}
